package nc.ui.lmzb.bill.pre;

import nc.ui.trade.business.HYPubBO_Client;
import nc.ui.trade.pub.IVOTreeData;
import nc.vo.lmzb.bidding.SmallBiddingHeaderVO;
import nc.vo.lmzb.pub.LmzbPubConst;
import nc.vo.pub.BusinessException;
import nc.vo.pub.SuperVO;
import nc.vo.scm.pu.PuPubVO;
import nc.vo.trade.pub.IBillStatus;
import nc.vo.trade.voutils.VOUtil;

public class PreBiddingLeftTreeData implements IVOTreeData {

	public String getShowFieldName() {
		return "cnameno";
	}

	public SuperVO[] getTreeVO() {
		String strWhere = "isnull(dr,0)=0 " +
				"and vbillstatus = "+IBillStatus.CHECKPASS+" " +
						"and ibusstatus = "+LmzbPubConst.BIDDING_BUSINESS_STATUE_SUBMIT;
		SuperVO[] vos = null;
		try {
//			String s = LmzbPubTool.getParam();
//		    if(s!=null &&!"".equals(s))
//		    	strWhere = strWhere+" and reserve1 = '"+s+"'";
			vos = HYPubBO_Client.queryByCondition(SmallBiddingHeaderVO.class, strWhere);
		} catch (BusinessException e) {
			e.printStackTrace();
			vos = null;
		}
		VOUtil.ascSort(vos,new String[]{"vbillno"});
		for(SuperVO vo:vos){
			vo.setAttributeValue("cnameno",PuPubVO.getString_TrimZeroLenAsNull(vo.getAttributeValue("vbillno"))+PuPubVO.getString_TrimZeroLenAsNull(vo.getAttributeValue("cname")));
		}
		return vos;
	}

}
